#include <boost/test/unit_test.hpp>

#include "airport.h"

using namespace std;
using namespace aviation;

BOOST_AUTO_TEST_CASE(TestAirportDefaultConstructor)
{
	//Constructs an object with an appropriate string
	Airport airport1;

	BOOST_REQUIRE(airport1.AsString() == "AAA");
}

BOOST_AUTO_TEST_CASE(TestAirportStringConstructor)
{
	// An airport code with good input.
	aviation::Airport airportCode1(std::string("LGW"));
	//Make sure we get the right output
	BOOST_REQUIRE(airportCode1.AsString() == "LGW");

	// Try lowercase letters
	aviation::Airport airportCode2(std::string("mAD"));
	BOOST_REQUIRE(airportCode2.AsString() == "MAD");

	aviation::Airport airportCode3(std::string("LhW"));
	BOOST_REQUIRE(airportCode3.AsString() == "LHW");

	aviation::Airport airportCode4(std::string("STn"));
	BOOST_REQUIRE(airportCode4.AsString() == "STN");

	// Try bad inputs. Each one should cause an exception (error message) to be thrown
	BOOST_CHECK_THROW(aviation::Airport(std::string("LAXX")), std::exception);
	BOOST_CHECK_THROW(aviation::Airport(std::string("LA")), std::exception);
	BOOST_CHECK_THROW(aviation::Airport(std::string("B1K")), std::exception);
	BOOST_CHECK_THROW(aviation::Airport(std::string("")), std::exception);

}

BOOST_AUTO_TEST_CASE(TestAirportCopyConstructor)
{
	// Copies the Date from another.
	Airport airport1("CTA");
	Airport airport2(airport1);
	BOOST_REQUIRE(airport1.AsString() == airport2.AsString());

}

BOOST_AUTO_TEST_CASE(TestAirportAssignmentOperator)
{
	// Assignment operator, copies from 'other'
	Airport airport1("LGA");
	Airport airport2;
	airport2 = airport1;
	BOOST_REQUIRE(airport1.AsString() == airport2.AsString());
}

 BOOST_AUTO_TEST_CASE(TestAirportComparisonEqualOperator)
{
	//Returns true if they are the same, or false if they arent
	Airport airport1(string("CMA"));
	Airport airport2(string("CMA"));

	BOOST_REQUIRE(airport1 == airport2);


}

 BOOST_AUTO_TEST_CASE(TestAirportComparisonNotEqualoperator)
{
	//Returns true if they are not the same, or false if they are
	Airport airport1(string("TTC"));
	Airport airport2(string("YYA"));
	BOOST_REQUIRE(airport1 != airport2);


}

 BOOST_AUTO_TEST_CASE(TestAirportAsString)
{
	//return the ariport AsString as a string
    Airport airport1(string("CDA"));

	BOOST_REQUIRE(airport1.AsString() == "CDA");

}